package com.shop.loan.model.vo;

import com.shop.loan.model.Goods;
import com.shop.loan.model.GoodsSize;
import lombok.Getter;
import lombok.Setter;
import xyz.erupt.annotation.Erupt;
import xyz.erupt.annotation.EruptField;
import xyz.erupt.annotation.sub_field.Edit;
import xyz.erupt.annotation.sub_field.EditType;
import xyz.erupt.annotation.sub_field.View;
import xyz.erupt.annotation.sub_field.sub_edit.ReferenceTreeType;

import javax.persistence.*;
import java.math.BigDecimal;

@Getter
@Setter
@Erupt(name = "test")
public class UpdateOrderGoodsVo extends HyperModelCreatorBaseVo {

    @ManyToOne
    @EruptField(
            views = @View(title = "商品", column = "name"),
            edit = @Edit(title = "商品", type = EditType.REFERENCE_TREE)
    )
    private Goods goods;

    @ManyToOne
    @EruptField(
            views = @View(title = "规格", column = "memory"),
            edit = @Edit(title = "规格", type = EditType.REFERENCE_TREE,
                    referenceTreeType = @ReferenceTreeType(dependField = "goods", label = "memory", dependColumn = "goods_id")
            )
    )
    private GoodsSize goodsSize;

    @EruptField(
            views = @View(title = "商品数量"),
            edit = @Edit(title = "商品数量")
    )
    private Integer number;

    @EruptField(
            views = @View(title = "订单金额"),
            edit = @Edit(title = "订单金额")
    )
    private BigDecimal price;

}
